#include <cassert>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <iostream>
using namespace std;

int main (int argc, char** argv)
{
    assert(argc == 3);
    //command line arguments are in order: username , new_password
    string username = argv[1];
    string password = argv[2];
    char c;
    ofstream output("temp.txt");
    
    output << "use cankidsdonordb_production" << endl;
    output << "update users set password=" << password << " where username=" << username << ";" << endl;
    
    output.close();
    
    std::cout << "temp is written" << endl;
    c = getchar();
    
    system("mysql -u root -p < temp.txt");
    
    return 0;
}
